package springinpractice.ch2.model;


import java.util.HashSet;
import java.util.Set;
import javax.persistence.*;
import org.hibernate.annotations.Cascade;

/*
 * @author	Willie Wheeler John Wheeler and Zeeshan Maqbool
 * Book		'Spring In Practice' [Book written by Willie Wheeler and John Wheeler]
 * 
 */

@Entity
@Table(name = "departments")
public class Department
{
	private Long dept_id;
	private String dept_name;
	//private Set<Employee> employees = new HashSet<Employee>();

	public Department()
	{	
	}
	
	public Department(String name)
	{
		this.dept_name = name;
	}

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	public Long getId()
	{
		return dept_id;
	}

	@SuppressWarnings("unused")
	private void setId(Long id)
	{
		this.dept_id = id;
	}

	public String getDept_name()
	{
		return dept_name;
	}

	public void setDept_name(String name)
	{
		this.dept_name = name;
	}

	/*
	@OneToMany(mappedBy = "department_id")
	@Cascade(org.hibernate.annotations.CascadeType.SAVE_UPDATE)
	public Set<Employee> getEmployees()
	{
		return employees;
	}

	public void setEmployees(Set<Employee> employees)
	{
		this.employees = employees;
	}

	public void addEmployee(Employee employee)
	{
		employees.add(employee);
		employee.setDepartment(this);
	}
	*/
}
